package net.jirox.staticengine.persistent;

import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;

public class User {
	public static boolean isExists(String login, String pass, PersistenceManager pm) {
		Query query = pm.newQuery(User.class);
		try {
			query.setFilter("login == loginParam && pass == passParam");
			query.declareParameters("String loginParam, String passParam");
			List<File> fileList = (List<File>) query.execute(login, pass);
			int count = fileList.size();
			return count != 0;
		} finally {
			query.closeAll();
		}
	}
}
